home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Frameworks / MacZoop 1.6.5 / Basic Classes / Z Headers / ZDefines.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-07  |  3.1 KB  |  122 lines  |  [TEXT/CWIE]

  1. /*************************************************************************************************
  2. *
  3. *
  4. *            ObjectMacZapp        -- a standard Mac OOP application template
  5. *
  6. *
  7. *
  8. *            ZDefines.h            -- some handy constants, etc
  9. *
  10. *
  11. *
  12. *
  13. *
  14. *            © 1996, Graham Cox
  15. *
  16. *
  17. *
  18. *
  19. *************************************************************************************************/
  20.  
  21. #pragma once
  22.  
  23. #ifndef __ZDEFINES__
  24. #define __ZDEFINES__
  25.  
  26. // standard basic resource IDs, etc.
  27.  
  28. #define        kSleepTime            10        // number of ticks to give up to background programs
  29. #define        kUntitledWindowID    128        // resource ID of the main window template
  30. #define        kAppleMenuID        128        // ID of the apple menu
  31.  
  32. #define        kShowAboutBox        1
  33. #define        kAboutBoxID            128
  34.  
  35. #define        kStdMenubarID        128        // ID of the default MBAR resource for the main menu bar
  36. #define        kMiscStrListID        128
  37. #define        kExceptionAlertID    130
  38. #define        kMemoryLowAlertID    132
  39.  
  40. #define        kShortageFundSize    65536    // leave 64K in reserve for emergencies.
  41.  
  42. // save changes alert constants
  43.  
  44. #define        kConfirmSaveAlertID    129
  45.  
  46. enum
  47. {
  48.     kConfirmSave = 1,
  49.     kCloseNoSave,
  50.     kCloseCancel
  51. };
  52.  
  53. // macros for extracting window/dialog objects from mac windows
  54.  
  55. #define        IS_ZWINDOW_KIND        772    // in the 'kind' field of the window record
  56.  
  57. #define        GetZWindow(w)        ((((WindowPeek) w)->windowKind == IS_ZWINDOW_KIND) || \
  58.                                  (((WindowPeek) w)->windowKind == dialogKind))? \
  59.                                     (ZWindow*) GetWRefCon(w) : NULL
  60.  
  61. #define        kStdScrollbarWidth        15
  62.  
  63.  
  64. // handy object disposal macros                                    
  65.  
  66. #define        ForgetObject(p)        {delete (p); (p) = NULL;}
  67. #define        ForgetThis()        {delete this;}
  68.  
  69. // common useful macros
  70.  
  71. #define        MIN(a,b)    ((a) < (b))? (a) : (b)
  72. #define        MAX(a,b)    ((a) > (b))? (a) : (b)
  73. #define        ABS(x)        (((x) < 0)?  (-1 * (x)) : (x))
  74. #define        CMP(a,b)    ((a) < (b))? -1 : ((a) > (b))? 1 : 0;
  75. #define        SGN(a)        (((a) < 0)? -1 : 1 )
  76.  
  77. // common non-ascii keys
  78.  
  79. #define        TAB_KEY                0x09
  80. #define        RETURN_KEY            0x0D
  81. #define        ENTER_KEY            0x03
  82. #define        ESCAPE_KEY            0x1B
  83. #define        UP_ARROW_KEY        0x1E
  84. #define        DOWN_ARROW_KEY        0x1F
  85. #define        LEFT_ARROW_KEY        0x1C
  86. #define        RIGHT_ARROW_KEY        0x1D
  87. #define        BACKSPACE_KEY        0x08
  88.  
  89. // undefined and quiet exceptions
  90.  
  91. #define        kUnknownExceptionErr    -999
  92. #define        kSilentErr                -1
  93.  
  94. // global structure provides some common gestalt results
  95.  
  96. typedef struct
  97. {
  98.     Boolean        supportsColour;
  99.     Boolean        hasDragManager;
  100.     Boolean        hasFPU;
  101.     Boolean        hasAppleEvents;
  102.     Boolean        hasAppearanceMgr;
  103.     Boolean        hasQuickTime;
  104.     Boolean        hasImgCompressionMgr;
  105.     short        systemVersion;
  106. }
  107. tMacInfo;
  108.  
  109. // handy basic pascal string utilities
  110.  
  111. void    CopyPString( ConstStr255Param srcString, Str255 destString );
  112. void    ConcatPStrings( Str255 first, ConstStr255Param second );
  113.  
  114. // if you wish to use the Appearance Manager-savvy parts of MacZoop when running under
  115. // System 7.7, #define the following. If undefined, will implement standard System 7 behaviour.
  116. // If you compile with this defined, things should still work on previous system versions.
  117. // Note that if you are building an appearance aware app with MacZoop, you need to link with
  118. // the AppearanceLib library as well as define this.
  119.  
  120. //#define        APPEARANCE_MGR_AWARE    1
  121.  
  122. #endif